<!DOCTYPE html>
<p>Test of Range.createContextualFragment() with in-scope namespace prefixes on elements. If the test succeeds you will see the word "PASS" below.</p>
<p id="result"></p>
<script type="text/javascript">
function onIframeLoad() {
    if (window.testRunner)
        testRunner.dumpAsText();

    var result = document.getElementById("result");
    result.textContent = "FAIL";

    var iframe = document.getElementById("iframe"),
        doc = iframe.contentDocument,
        range = doc.createRange(),
        docFragment;

    var defs = doc.getElementById("defs");
    range.setStart(defs, 0);
    docFragment = range.createContextualFragment("<\u0108:test id='test1'/><\u015D:test id='test2'/>");
    defs.appendChild(docFragment);

    var test1 = doc.getElementById("test1");
    if (test1.namespaceURI != "urn:x-test:U+0108") {
        result.textContent += " - #test1 is in the wrong namespace";
        return;
    }
    var test2 = doc.getElementById("test2");
    if (test2.namespaceURI != "urn:x-test:U+015D") {
        result.textContent += " - #test2 is in the wrong namespace";
        return;
    }

    result.textContent = "PASS";
}
</script>
<iframe id="iframe" src="resources/svg-document-ns2.svg" onload="onIframeLoad()"></iframe>
